package com.example.martian.controller;

import com.example.martian.service.RedPackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;
import java.math.BigDecimal;

@CrossOrigin
@Controller
@RequestMapping("/rate/")
public class RedPackController {

    @Autowired
    private RedPackService redPackService;

    //红包币种
    @ResponseBody
    @RequestMapping(value = "checkCoin")
    public Object checkCoin() throws IOException {
        return redPackService.checkCoin();
    }

    //塞钱进红包
    @ResponseBody
    @RequestMapping(value = "sendRedPacket")
    public Object sendRedPacket(String coin, String sendMoney, String address,Integer typeMoney,
                                Integer type, Integer number, String cipher, Integer jypassword,String addressUid){
        return redPackService.sendRedPacket(coin, sendMoney, address, typeMoney, type, number, cipher, jypassword,addressUid);
    }

    //抢红包
    @ResponseBody
    @RequestMapping(value = "cipherHongbao")
    public Object cipherHongbao(String cipher,String address){
        return redPackService.cipherHongbao(cipher, address);
    }

    //收红包记录
    @ResponseBody
    @RequestMapping(value = "selectRedPacketRoll")
    public Object selectRedPacketRoll(String address){
        return redPackService.selectRedPacketRoll(address);
    }

    //发红包记录
    @ResponseBody
    @RequestMapping(value = "selectRedPacket")
    public Object selectRedPacket(String address){
        return redPackService.selectRedPacket(address);
    }
}
